<template>
  <div>
    <h2>请选择你喜欢的栏目</h2>
    <span v-for="(item, index) in arr" :key="index">
      <input
        type="checkbox"
        v-model="hobby"
        :value="item"
        @click="handle"
        name="arr"
      />
      <span>{{ item }}</span>
    </span>
    <ul>
      <li v-for="(item,index) in hobby" :key="index">{{ item}}</li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: ["科幻", "喜剧", "动漫", "冒险", "科技", "军事", "娱乐", "奇闻"],
      hobby: [],
    };
  },
  methods: {
    handle() {
      console.log(this.hobby);
      // this.hobby.push(this.arr[0]);
      // this.hobby.shift();
   
    },
  },
};
</script>

<style>
</style>